#Hangman
wordbank = ["dog","cat","fish","bird","bug","turtle","frog","snake","duck","spider","leprachaun"]
import random
word = random.choice(wordbank)
lives = 0
graphic=["""|
            |
            |
            |
            |
            |
            |""",
         """-----------""",
         """           |
                       |""",]
length = len(word)
dasharray = list(length*"_")
wordarray = list (word)
print dasharray

while lives<9:
    guess = raw_input ("Guess a letter: ")
    i = 0
    while i<length:
        if wordarray[i] == guess:
                dasharray[i] = guess
                i = i+1
        else:
                i = i+1
    if guess not in word:
        print graphic[lives]
        lives=lives+1
    print dasharray
